package com.codejob.portal.web.action.algorithm;

import java.util.List;

import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;

import com.codejob.portal.entity.algorithm.Algorithm;
import com.codejob.portal.services.impl.algorithm.AlgorithmManager;
import com.codejob.portal.services.intf.BusinessExcption;
import com.codejob.portal.web.BaseAction;

@Namespace("/algorithm")
@Results({@Result(name="index",location="../index.jsp",type="redirect")})
public class AlgorithmAction extends BaseAction {

	private static final long serialVersionUID = 7540893528383878340L;

	private Algorithm algorithm;
	
	private Long problemId;
	
	private List<Algorithm> algList;
	
	@Autowired
	AlgorithmManager problemManager;
	
	public String list(){
		try {
		
			algList=problemManager.getAlgList(problemId);
		} catch (BusinessExcption e) {
			e.printStackTrace();
		}
		return "list";
	}

	public Algorithm getAlgorithm() {
		return algorithm;
	}

	public void setAlgorithm(Algorithm algorithm) {
		this.algorithm = algorithm;
	}

	public List<Algorithm> getAlgList() {
		return algList;
	}

	public void setAlgList(List<Algorithm> algList) {
		this.algList = algList;
	}

	public Long getProblemId() {
		return problemId;
	}
	
	public void setProblemId(Long problemId) {
		this.problemId = problemId;
	}


	public void setProblemId(String problemId) {
		this.problemId = Long.parseLong(problemId);
	}

	

}
